Skip to content

Add escape hatch for mutation convention name formatting#9782

Merged
michaelstaib merged 2 commits into
mainfrom
mst/mutation-convention-escape-hatch
May 27, 2026
Merged

Add escape hatch for mutation convention name formatting#9782
michaelstaib merged 2 commits into
mainfrom
mst/mutation-convention-escape-hatch

Conversation

@michaelstaib
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 27, 2026 07:15
@michaelstaib michaelstaib changed the title Add escape hatch for mutation name formatting wuth mutation conventions Add escape hatch for mutation convention name formatting May 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an escape hatch for mutation convention name formatting so selected mutation fields can preserve their configured field name when generating convention-based input, payload, and error type names.

Changes:

  • Adds a new DisableMutationReformatting field flag and public ObjectFieldConfiguration property.
  • Threads the field configuration through mutation type-name formatting and bypasses mutation-name reformatting when the flag is set.
  • Adds a test helper and coverage for preserved input/payload names on prefixed mutation fields.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/HotChocolate/Core/src/Types/Types/Descriptors/Configurations/CoreFieldFlags.cs Adds the internal flag backing the new escape hatch.
src/HotChocolate/Core/src/Types/Types/Descriptors/Configurations/ObjectFieldConfiguration.cs Exposes the flag as a public field configuration property.
src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs Applies the escape hatch when formatting mutation-derived input, payload, and error type names.
src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs Adds a prefixed mutation test for preserved input and payload type names.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +878 to +881
public string FormatErrorTypeName(ObjectFieldConfiguration mutation)
=> PayloadErrorTypeNamePattern.Replace(
$"{{{MutationConventionOptionDefaults.MutationName}}}",
FormatMutationName(mutationName));
FormatMutationName(mutation));
@michaelstaib michaelstaib merged commit 1c8cbad into main May 27, 2026
11 of 12 checks passed
@michaelstaib michaelstaib deleted the mst/mutation-convention-escape-hatch branch May 27, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants